Skip to content

chore: fix ts-check comment ordering - #23386

Open
btea wants to merge 2 commits into
vitejs:mainfrom
btea:chore/add-sortImports-partitionByComment
Open

chore: fix ts-check comment ordering#23386
btea wants to merge 2 commits into
vitejs:mainfrom
btea:chore/add-sortImports-partitionByComment

Conversation

@btea

@btea btea commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

https://oxc.rs/docs/guide/usage/formatter/config-file-reference.html#sortimports-partitionbycomment

vite/eslint.config.js

Lines 2 to 3 in ee64401

import eslint from '@eslint/js'
import pluginImportX from 'eslint-plugin-import-x'

After swapping the second and third lines and running pnpm format, the third line becomes the first line, before the comment // @ts-check.

@bluwy

bluwy commented Sep 1, 2026

Copy link
Copy Markdown
Member

I'd say the current behaviour is right though since any comment we put before an import could be describing that import, and we don't want to use comments as partitions to group imports.

In this case we could add an extra new line after // @ts-check to avoid the problem if we want.

@btea

btea commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

In this case we could add an extra new line after // @ts-check to avoid the problem if we want.

Yeah, that does solve the problem, though it looks a little strange.

@bluwy bluwy changed the title chore: set sortImports.partitionByComment to true chore: fix ts-check comment ordering Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants